﻿using System.Collections.Generic;

using RayDen.RayEngine.Data;
using RayDen.RayEngine.Scene;

namespace RayEngine.Spectral.Entities
{
    public abstract class BaseSceneObject : IScenePrimitive
    {
        public TriangleMeshInfo Mesh;

        protected HashSet<uint> indexes;

        public int ID { get; set; }

        public int ChildID;

        public abstract ScenePrimitiveType PrimitiveType
        {
            get;
        }

        protected BaseSceneObject(TriangleMeshInfo mesh)
        {
            indexes = new HashSet<uint>();
            this.Mesh = mesh;
            if (mesh != null)
            {
                for (var i = (uint) mesh.StartTriangle; i < mesh.EndTriangle; i++)
                {
                    indexes.Add(i);
                }
            }
        }

        public bool OwnsIndex(uint index)
        {
            return indexes.Contains(index);
        }

    }
}
